const path = require('path')
const HTMLPlugin = require('prerender-spa-plugin')
var Renderer = HTMLPlugin.PuppeteerRenderer
const htmlOptions = {
  staticDir: path.join(__dirname, '../dist'),
  routes: ['/index', '/aboutus', '/login'],
  renderer: new Renderer({
    /*//忽略打包错误
    ignoreJSErrors: true,*/
    phantomOptions: '--web-security=false',
    maxAttempts: 10,
    renderAfterTime: 5000,
    headless: false,
  })
}
module.exports = {
  env: {
    NODE_ENV: '"production"'
  },
  defineConstants: {
  },
  weapp: {},
  h5: {
    webpackChain (chain, webpack) {
      chain
        .plugin('html')
        .use(HTMLPlugin, [htmlOptions])
    }
  }
}
